package com.li.arithmetic;

import java.util.ArrayList;
import java.util.List;

public class DividePrimeNumber {
	private static StringBuilder fomula=new StringBuilder();
	public static void main(String[] args) {
		getDPNumber(90);
	}
	
	public static List<Integer> getDPNumber(int number){
		List<Integer> list=new ArrayList<Integer>();
		for(int i=2;i<=number;i++){
			isDPNumber(i);
			System.out.println(i+"="+fomula.deleteCharAt(fomula.length()-1));
			fomula.delete(0, fomula.length());
		}
		return list;
	}
	
	public static void isDPNumber(int number){
		List<Integer> list=new ArrayList<Integer>();
		for(int i=2;i<=number;i++){
			if(number%i==0 && isPrimeNumber(i)){
				fomula.append(i+"*");
				isDPNumber(number/i);
				break;
			}
		}
	}
	
	public static boolean isPrimeNumber(int number){
		for(int i=2;i<=Math.sqrt(number);i++){
			if(number%i==0)
				return false;
		}
		return true;
	}
}
